package com.egao.common.component.elasticsearch.entity;

import com.egao.common.module.company.constants.RecruitConstants;

/**
 * ElasticSearch 常量
 * @author lym
 */
public class ElasticSearchConstants {

    /**
     * 请求超时时间
     */
    public static final String TIME_OUT = "10s";

    /**
     * 索引名称：信息类索引
     */
    public static final String INDEX_NAME_INFORMATION = "information";

    /**
     * 索引名称：信息类索引
     */
    public static final String INDEX_NAME_PUSH_MSG = "msg";

    /**
     * 信息类搜索索引-新闻类型
     */
    public static final String INFORMATION_NEWS = "1";
    /**
     * 信息类搜索索引-公务员类型
     */
    public static final String INFORMATION_SERVANT = "2";
    /**
     * 信息类搜索索引-校园招聘类型
     */
    public static final String INFORMATION_SCHOOL_RECRUIT = "3";



    /**
     * 信息类索引-招聘信息类型
     */
    public static final String INFORMATION_RECRUIT = "1";
    /**
     * 信息类索引-校内宣讲会信息类型
     */
    public static final String INFORMATION_PREACH = "2";
    /**
     * 信息类索引-空中宣讲会信息类型
     */
    public static final String INFORMATION_PREACH_CLOUD = "3";
    /**
     * 信息类索引-校内双选会信息类型
     */
    public static final String INFORMATION_MUTUAL = "4";
    /**
     * 信息类索引-推送信息类型
     */
    public static final String INFORMATION_PUSH_MSG = "5";
    /**
     * 信息类索引-文章信息类型
     */
    public static final String INFORMATION_ARTICLE = "6";
    /**
     * 信息类索引-公务员信息类型
     */
    public static final String INFORMATION_OFFICIAL = "7";

    /**
     * 搜索类型属性名
     */
    public static final String SEARCH_TYPE = "elasticSearchType";

    /**
     * 多类型搜索结果对象无属性时空字符串值对象
     */
    public static final String SEARCH_NULL = "elasticSearchNull";



    /**
     * 获取信息类型名称
     */
    public static String getCategoryName(String category) {
        String name = "";
        switch (category) {
            case INFORMATION_RECRUIT:
                name = "招聘信息";
                break;
            case INFORMATION_PREACH:
                name = "校内宣讲会";
                break;
            case INFORMATION_PREACH_CLOUD:
                name = "空中宣讲会";
                break;
            case INFORMATION_MUTUAL:
                name = "校内双选会";
                break;
            default: name = "";
        }
        return name;
    }



    /**
     * 获取信息类型地址
     */
    public static String getCategoryUrl(String category, String subcategory) {
        String url;
        switch (category) {
            case INFORMATION_RECRUIT:
                url = RecruitConstants.TYPE_ONLINE.equals(subcategory) ? "/home/career/onlinerecruitment" : "/home/career/internship";
                break;
            case INFORMATION_PREACH:
                url = "/home/career/preachmore";
                break;
            case INFORMATION_PREACH_CLOUD:
                url = "/home/career/cloudmore";
                break;
            case INFORMATION_MUTUAL:
                url = "/home/career/doublechoosemore";
                break;
            case INFORMATION_ARTICLE:
                url = "/home/article/details";
                break;
            case INFORMATION_OFFICIAL:
                url = "/home/official/details";
                break;
            default: url = "";
        }
        return url;
    }
}
